package com.tang.model.factorymethod;

import java.util.Objects;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/8/15 12:25
 * @Desc
 * @Remarks
 */
public class PythonCourseFactory implements ICourseFactory {

    private static volatile PythonCourseFactory pythonCourseFactory;

    private PythonCourseFactory() {

    }

    public static PythonCourseFactory getInstance() {
        if (Objects.isNull(pythonCourseFactory)) {
            synchronized (PythonCourseFactory.class) {
                if (Objects.isNull(pythonCourseFactory)) {
                    pythonCourseFactory = new PythonCourseFactory();
                }
            }
        }
        return pythonCourseFactory;
    }

    @Override
    public ICourse createInstance() {
        return new PythonCourse();
    }
}
